<template>
	<view class="main">
		<view>
			<u-form>
				<u-form-item label-width="120" label="选择院系">
					<u-input v-model="yuanxi" type="select" :border="true" @click="specialtyNameListshow = true"/>
				</u-form-item>
				<u-form-item label-width="120" label="选择专业">
					<u-input v-model="zhuanye" type="select" :border="true" @click="specialtyNameListshow = true"/>
				</u-form-item>
				<u-form-item label-width="120" label="选择班级">
					<u-input v-model="banji" type="select" :border="true" @click="specialtyNameListshow = true"/>
				</u-form-item>
			</u-form>
			<u-button type="primary" @click="faxian()">发现同学</u-button>
			<u-select v-model="specialtyNameListshow" mode="mutil-column-auto" :list="specialtyNameList" @confirm="confirm"></u-select>
		</view>
		<view class="showArea">
			<u-card :title='item.name' :sub-title='item.sex' v-for='item in datainfo'>
				<view class="" slot="body">
					<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
						<view class="u-body-item-title u-line-2">联系方式：{{item.telephone}}</view>
					</view>
				</view>
			</u-card>
		</view>
		<view class="showArea2" v-if="areaShow">
			暂未发现您的同学！
		</view>
	</view>
</template>

<script>
	export default{
		components:{
			
		},
		data(){
			return{
				subTitle: '2020-05-15',
				
				// thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
				yuanxi:'',
				zhuanye:'',
				banji:'',
				areaShow:false,
				specialtyNameList:[
					{
						value:1,
						label:'信息院',
						children:[
						{value:999,label:'',children:[{value:997,label:''}]},
						{value:11,label:'物联网工程',children:
							[{value:998,label:''},{value:111,label:'物联网工程21-1'},{value:112,label:'物联网工程21-2'}]},
						{value:12,label:'计算机科学与技术',children:
						[{value:121,label:'计算机21-1'},{value:122,label:'计算机21-2'}]},
						{value:13,label:'网络工程',children:
						[{value:131,label:'网络工程21-1'},{value:132,label:'网络工程21-2'}]},
						{value:14,label:'应用统计'},
						{value:15,label:'软件工程'}]},
					{value:2,label:'水建院',children:[{value:21,label:'专业1'},{value:22,label:'专业2'},{value:23,label:'专业3'},{value:24,label:'专业4'},{value:25,label:'专业5'}]},
					{value:3,label:'人文院',children:[{value:31,label:'专业1'},{value:32,label:'专业2'},{value:33,label:'专业3'},{value:34,label:'专业4'},{value:35,label:'专业5'}]},
					{value:4,label:'动科院',children:[{value:41,label:'专业1'},{value:42,label:'专业2'},{value:43,label:'专业3'},{value:44,label:'专业4'},{value:45,label:'专业5'}]}
				],
				specialtyNameListshow:false,
				datainfo:[]
			}
		},
		onShow() {
			
		},
		methods:{
			confirm(e){
				console.log(e)
				this.yuanxi=e[0].label
				this.zhuanye=e[1].label
				this.banji=e[2].label
			},
			faxian(){
				var _this=this
				if(_this.yuanxi==''){
					uni.showToast({
						title:'至少选择一个筛选条件',
						icon:'none'
					})
				}else{
					var url='http://taruinfo.work:8088/newborn/likeLeftNewbornByLists?className='+this.banji+'&current=1&discipline='+this.zhuanye+'&facultyName='+this.yuanxi+'&size=10';
					uni.request({
						url:url,
						method:'get',
						success:function(res){
							// console.log(res.data.data.records)
							_this.datainfo=res.data.data.records
							if(_this.datainfo.length==0){
								_this.areaShow=true
							}else{
								_this.areaShow=false
							}
							// console.log('获取到的数据')
							// console.log(_this.datainfo)
						},
						fail:function(res){
							uni.showToast({
								title:res.data.message,
								icon:'none'
							})
						}
					})
				}
			}
		}
	}
</script>

<style>
	.main{
		margin-left:15rpx;
		margin-right:15rpx;
	}
	.showArea2{
		text-align: center;
		margin-top: 280rpx;
	}
</style>
